//
// Interface.h
// Your copyright notice
//

#ifndef __PLUGININTERFACE__
#define __PLUGININTERFACE__

#include <e32base.h>
#include <ecom\ECom.h>
#include <badesca.h>

#include <coecntrl.h>
#include <eikmenup.h>
#include <gdi.h>

#include "MPluginAdapter.h"
#include "MPluginContainer.h"

// UID of this interface
const TUid KCPluginInterfaceUid = {0x10001AF0};

class CPluginInterface : public CBase, public MPluginAdapter
{
public:
	// The interface for passing initialisation parameters
	// to the derived class constructor.
	struct TPluginInterfaceInitParams
	{
		const TRect* iRect;
	};

	// Instantiates an object of this type 
	static CPluginInterface* NewL();

	// Instantiates an object of this type 
	// using the aMatchString as the resolver parameters.
	static CPluginInterface* NewL(const TDesC8& aMatchString);

	// Instantiates an object of this type
	// using the aMatchString as the resolver parameters
	// and passing the aParams parameters 
	static CPluginInterface* NewL(const TDesC8& aMatchString, TPluginInterfaceInitParams& aParams);

	// Destructor.
	virtual ~CPluginInterface();

	// Request a list of all available implementations which 
	// satisfy this given interface.
	static void ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray);

	// Pure interface method
	// Representative of a method provided on the interface by 
	// the interface definer.

	//Ui container
	virtual void SetContainer(MPluginContainer* aContainer) { iContainer = aContainer; };

	//Menus
	virtual const TDesC& GetMenuText() = 0;
	virtual TInt GetMenuCommand() = 0;
	virtual void AddExtraMenu(CEikMenuPane* aMenuPane) = 0;
	virtual void HandleCommandL(TInt aCommand) = 0;
	virtual TKeyResponse HandleKeyEventL(const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/) { return EKeyWasConsumed; };

	virtual void Draw(CWindowGc& aGc, const TRect& aRect) const = 0;

	virtual TRgb BackBorderColor() const { return KRgbWhite; }
	virtual TRgb BackShadowColor() const { return KRgbWhite; }
	virtual TRgb BackColor() const { return KRgbWhite; }
	virtual TRgb InsideBorderColor() const { return KRgbWhite; }
	virtual TRgb InsideColor() const { return KRgbWhite; }
	virtual TRgb ForeColor() const { return KRgbWhite; }

	virtual void Activate() = 0;
	virtual void Deactivate() = 0;


protected:
	//Default c'tor
	inline CPluginInterface();

	//UI container
	MPluginContainer* iContainer;


public:
	// Unique instance identifier key
	TUid iDtor_ID_Key;

};

#include "PluginInterface.inl"

#endif 

